#define _CRT_SECURE_NO_WARNINGS 1
#include "address.book.h"

void Contactmemory(contact* pf)
{
	if (pf->memory == pf->size)
	{
		int newmemory = pf->memory == 0 ? 4 : 2 * pf->memory;
		contacts*pf1 = (contacts*)realloc(pf->arr, newmemory * sizeof(contacts));
		if (pf1 == NULL)
		{
			perror("realloc:pf1 is faild");
			return 1;
		}
		pf->memory = newmemory;
	}
}

void Contactinit(contact* pf)
{
	pf->arr = NULL;
	pf->memory = pf->size = 0;
}

void Contactdate(contact* pf)
{
	if (pf->arr)
	{
		free(pf->arr);
	}
	pf->memory = pf->size = 0;
}

void Contactpush(contact* pf, contacts x)
{
	Contactmemory(pf);

}